#include "stdafx.h"
#include "LoggedEvent.h"

unsigned int CLoggedEvent::nextId = 0;

CLoggedEvent::CLoggedEvent(EventType type, QString name, QString details):
m_event(type),m_name(name),m_details(details),m_id(++nextId)
{
	qDebug("LoggedEvent[0x%08x]::LoggedEvent(EventType, QString, QString)", this);
}

CLoggedEvent::CLoggedEvent():
m_event(INFO),m_id(++nextId)
{	
	qDebug("LoggedEvent[0x%08x]::LoggedEvent()", this);
}

CLoggedEvent::CLoggedEvent( const CLoggedEvent& copy ):
m_event(copy.m_event),m_name(copy.m_name),m_details(copy.m_details),m_id(copy.m_id)
{
	qDebug("LoggedEvent[0x%08x]::LoggedEvent(const CLoggedEvent&)", this);
}

CLoggedEvent::~CLoggedEvent(void)
{
	qDebug("LoggedEvent[0x%08x]::~LoggedEvent", this);
}

void CLoggedEvent::SetName( const QString& name)
{
	qDebug("LoggedEvent[0x%08x]::SetName", this);
	m_name = name;
	emit StateUpdated(this);
}

void CLoggedEvent::SetType( EventType type)
{
	qDebug("LoggedEvent[0x%08x]::SetType", this);
	m_event = type;
	emit StateUpdated(this);
}

void CLoggedEvent::UpdateMessage( QString message)
{
	qDebug("LoggedEvent[0x%08x]::UpdateMessage", this);
	m_details = message;
	emit StateUpdated(this);
}

void CLoggedEvent::UpdateStatus( EventType type)
{
	qDebug("LoggedEvent[0x%08x]::UpdateStatus", this);
	m_event = type;
	emit StateUpdated(this);
}